package us.wili.dev.common.util.qiniu;

import com.qiniu.common.Zone;

/**
 * Created by JasonY on 17/6/3.
 */
public class QiniuProperties {

    protected long expireSeconds = 3600L;

    protected String accessKey;
    protected String secretKey;

    protected String bucket;
    protected Boolean ifPublic;
    protected String domain;
    protected String zoneName;
    protected String callbackUrl;
    protected String callbackBodyType;

    public QiniuProperties(){}

    public QiniuProperties(String accessKey, String secretKey, String bucket, Boolean ifPublic, String domain, String zoneName) {
        this.accessKey = accessKey;
        this.secretKey = secretKey;
        this.bucket = bucket;
        this.ifPublic = ifPublic;
        this.domain = domain;
        this.zoneName = zoneName;
    }

    public long getExpireSeconds() {
        return expireSeconds;
    }

    public void setExpireSeconds(long expireSeconds) {
        this.expireSeconds = expireSeconds;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public Boolean getIfPublic() {
        return ifPublic;
    }

    public void setIfPublic(Boolean ifPublic) {
        this.ifPublic = ifPublic;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getCallbackUrl() {
        return callbackUrl;
    }

    public void setCallbackUrl(String callbackUrl) {
        this.callbackUrl = callbackUrl;
    }

    public String getZoneName() {
        return zoneName;
    }

    public void setZoneName(String zoneName) {
        this.zoneName = zoneName;
    }

    public String getCallbackBodyType() {
        return callbackBodyType;
    }

    public void setCallbackBodyType(String callbackBodyType) {
        this.callbackBodyType = callbackBodyType;
    }

    public Zone toZone(String zoneName){
        switch (zoneName) {
            case "zone0": return Zone.zone0();      // 华东
            case "zone1": return Zone.zone1();      // 华北
            case "zone2": return Zone.zone2();      // 华南
            case "autoZone": return Zone.autoZone();
            default: return null;
        }
    }

    public Zone toZone(){
        return toZone(zoneName);
    }
}
